package com.hnevc.caoliuye;

import java.io.*;

/**
 * 使用包装流进行文件拷贝
 * BufferedReader
 * BufferedWriter
 *
 */
public class Example03 {
    public static void main(String[] args) {
        try {
            FileReader reader = new FileReader("text.txt");
            BufferedReader bf = new BufferedReader(reader);
            FileWriter writer = new FileWriter("src\\text2.txt");
            BufferedWriter wr = new BufferedWriter(writer);
            String str;//每行读取的内容存放到str
            while ((str = bf.readLine())!=null){
                wr.write(str);
                wr.newLine();
            }
            bf.close();
            wr.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
